﻿@model IQueryable<Home.Site.Models.DataLayer.PhotoAlbum>
@{
    ViewBag.Title = ViewBag.Message;
}
<script type="text/javascript">
    var page = 0;
    var _inCallback = false;
    function loadAlbums() {
        if (page > -1 && !_inCallback) {
            _inCallback = true;
            page++;
            $('div#loading').html('<p><img src="/Content/images/loading.gif"></p>');
            $.get("/Album/Album/" + page, function (data) {
                if (data != '') {
                    $("#albumList").append(data);
                }
                else {
                    page = -1;
                }
                _inCallback = false;
                $('div#loading').empty();
            });
        }
    }
    var dcList = true;
    $(window).scroll(function () {
        if ($(window).scrollTop() == $(document).height() - $(window).height()) {
            loadAlbums();
        }
    });
</script>
<h2>@ViewBag.Message</h2>
<div id="albumList">
    @Html.Partial("_Albums")
</div>
<div id="loading"></div> 
@section Scripts {
    @Scripts.Render("~/bundles/vk_upback")
}



